<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="../common/include/header.jsp" %>
<%@ page import="model.*" %>
<%@ page import="java.util.*" %>
<%@ page import="admin.*" %>
<div width="980px">
<script type="text/javascript">
	
	/*
	검색 Action 호출
	*/
	function getSearch(SearchKind)
	{
		document.customActionForm.method.value = "search";
		
		//선택입력
		if(SearchKind == "0")
		{
			document.customActionForm.searchkind.value ="0";
		}
		else	//이름입력
		{
			document.customActionForm.searchkind.value ="1";
			if(document.customActionForm.searchMember_input.value =="")
			{
				alert("입력한 ID 또는 이름을 입력해 주세요.");
				document.customActionForm.searchMember_input.focus();
				return;
			}
		}
		
		document.customActionForm.submit();//검색요처한다.
		
	}
	
	/*
	검색된 유저의 정보중 관리자 레벨을 변경한다.
	*/
	function getUpdate(originLV)
	{
		//레벨이 같지 않은 상태에만 갱신을 가능하도록.
		if(document.customActionForm.level.value != originLV)
		{
			if(originLV == 9)
			{
				alert("최고 관리자는 사용자의 레벨로 변경 될 수 없습니다.");
				return false;
			}
			document.customActionForm.method.value = "update";
			document.customActionForm.submit();	////갱신요청
		}
		else
		{
			alert("현재 레벨과 동일합니다.");
			return false;
		}
	}
</script>
<table style="width: 980px;" cellpadding="0" cellspacing="0">
	<tr>
		<td style="width: 180px;background: #e76969;vertical-align: top;">
			<!-- 메뉴화면 ------------------------------- -->
			<%@ include file="./menu.jsp" %>
			<!-- 메뉴화면 ------------------------------- -->
		</td>
	
		<td style="width: 800px;vertical-align: top;text-align: center;">
			
			<!-- 실제 컨텐츠 화면 표시부분 -->
			<html:form action="/custom" method="post">
			
			<input type="hidden" name="method" value="search" />
			<input type="hidden" name="searchkind" value="" />
			<input type="hidden" name="totalCount" value="" />
			<!-- <html:hidden property="totalCount"/> -->
			
			<jsp:useBean id="customActionForm" type="admin.CustomForm" scope="request" ></jsp:useBean>
			
<div style="height: 10px;"></div>
			<!-- 회원정보부 -->
		<table style="width: 700px;border: 1px solid #e76969;padding: 10px;" cellpadding="0" cellspacing="0"><tr><td>
			<table style="width: 600px;border: 1px solid #e76969;" cellpadding="2" cellspacing="1">
				<tr><td colspan="3" style="background: #e76969;color: white;font-weight: bold;height: 20px;">MYITEA 회원정보</td></tr>
				<tr>
					<td class="adminTd2" style="width: 200px;">회원수</td>
					<td style="width: 200px;"><bean:write name="customActionForm" property="totalCount"/>&nbsp;명</td>
					<td></td>
				</tr>
				<tr>
					<td class="adminTd2">회원아이디 목록</td>
					<td>
						<!-- 아이디 목록 표시부 --------------------------------------------------- -->
						<select name="searchMember_select" style="font-size: 8pt;height: 18px;width: 200px;">
						
						<logic:iterate id="userinfo" name="customActionForm" property="members" type="model.Member">
							<logic:equal name="userinfo" property="mid" value="<%=customActionForm.getSearchMember_select() %>">
								<option value='<bean:write name="userinfo" property="mid"/>' selected="selected"><bean:write name="userinfo" property="mid"/>-<bean:write name="userinfo" property="mname"/></option>
							</logic:equal>
							
							<logic:notEqual name="userinfo" property="mid" value="<%=customActionForm.getSearchMember_select() %>">
								<option value='<bean:write name="userinfo" property="mid"/>'><bean:write name="userinfo" property="mid"/>-<bean:write name="userinfo" property="mname"/></option>							
							</logic:notEqual>
							
						</logic:iterate>
						
						</select>
					</td>
					<td style="width: 200px;">
						<!-- ---------------------------------------------------------------------- -->
						<html:button property="" value="정보조회" onclick="getSearch('0');" styleClass="adminBtnCnf" style="width: 190px;"></html:button>
					</td>
			
				</tr>
				<!-- 회원검색부 -------------------------------------------------------------- -->
				<tr>
					<td class="adminTd2" style="width: 200px;">회원검색</td>
					<td style="width: 200px;">
						이름<html:checkbox property="fromName"></html:checkbox>&nbsp;<html:text property="searchMember_input" style="width: 140px;height: 14px;font-size: 8pt;"></html:text>
					</td>
					<td><html:button property="" value="검색" onclick="getSearch('1');" styleClass="adminBtnCnf" style="width: 190px;"/></td>
				</tr>
				<!-- ----------------------------------------------------------------------------- -->
			</table>
			
<div style="height: 10px;"></div>
			<!-- 회원정보표시부 -->
			<logic:notEmpty property="member" name="customActionForm">
				
				<logic:iterate id="mem" name="customActionForm" property="member" type="model.Member">
					<table style="width: 600px;border: 1px solid #e76969;" cellpadding="2" cellspacing="1">
						<tr>
							<td class="adminTd2" style="width: 200px;">아이디</td>
							<td class="adminTd1" style="width: 400px;">
							<bean:write name="mem" property="mid"/>
							<html:hidden name="mem" property="mid" /><!-- value='<bean:write name="mem" property="mid"/>' -->
							</td>
						</tr>
						<tr>
							<td class="adminTd2">유저이름</td>
							<td class="adminTd1"><bean:write name="mem" property="mname"/></td>
						</tr>
						<tr>
						<td class="adminTd2">유저레벨</td>
						<td class="adminTd1">
							
							<!-- ---------------------------------------------------------------------------------------- -->
							<SELECT name="level" style="height: 18px;font-size: 8pt;width: 100px;">
							<logic:iterate id="memLv" name="customActionForm" property="memberLv" type="model.MemberLevel">
		
								<logic:equal name="memLv" property="lvno" value="<%= String.valueOf(mem.getLvno()) %>"  >
								
									<option value='<bean:write name="memLv" property="lvno" />' selected="selected">
										<bean:write name="memLv" property="lvname" />
									</option>
									
								</logic:equal>
								
								<logic:notEqual name="memLv" property="lvno" value="<%= String.valueOf(mem.getLvno()) %>">
									<option value='<bean:write name="memLv" property="lvno" />'>
										<bean:write name="memLv" property="lvname" />
									</option>
								</logic:notEqual>
							</logic:iterate>
							</SELECT>
							<!-- ---------------------------------------------------------------------------------------- -->
							
						<input type="button" value="수정" onclick="getUpdate(<bean:write name="mem" property="lvno"/>);" class="adminBtnCnf" style="width: 90px;"/>
						</td>
					</tr>
					<tr>
						<td class="adminTd2">생년월일</td>
						<td class="adminTd1"><bean:write name="mem" property="mbirth"/></td>
					</tr>
					<tr>
						<td class="adminTd2">이메일</td>
						<td class="adminTd1"><bean:write name="mem" property="memail"/></td>
					</tr>
					<tr>
						<td class="adminTd2">주소(오피스)</td>
						<td class="adminTd1">
						<logic:notEmpty name="mem" property="maddresso"><bean:write name="mem" property="maddresso"/></logic:notEmpty>
						<logic:empty name="mem" property="maddresso">미입력</logic:empty>
						</td>
					</tr>
					<tr>
						<td class="adminTd2">전화번호(오피스)</td>
						<td class="adminTd1">
						<logic:notEmpty name="mem" property="mphoneo"><bean:write name="mem" property="mphoneo"/></logic:notEmpty>
						<logic:empty name="mem" property="mphoneo">미입력</logic:empty>
						</td>
					</tr>
					<tr>
						<td class="adminTd2">주소(집)</td>
						<td class="adminTd1"><bean:write name="mem" property="maddressh"/>
						<logic:empty name="mem" property="mphoneo">미입력</logic:empty>
						</td>
					</tr>
					<tr>
						<td class="adminTd2">전화번호(집)</td>
						<td class="adminTd1">
						<logic:notEmpty name="mem" property="mphoneh"><bean:write name="mem" property="mphoneh"/></logic:notEmpty>
						<logic:empty name="mem" property="mphoneh">미입력</logic:empty>
						</td>
					</tr>
					<tr>
						<td class="adminTd2">가입일시</td>
						<td class="adminTd1">	<bean:write name="mem" property="mregdate"/>						
						</td>
					</tr>
					</table>
				</logic:iterate>
			</logic:notEmpty>
		</td></tr></table>
				<!-- ------------------------------------------------------------------------------------------- -->
			</html:form>
		</td>
	</tr>
</table>
</div>
<%@ include file="../common/include/footer.jsp" %>